package org.jjche.file.modules.file.api.vo;

import cn.hutool.core.io.unit.DataSizeUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jjche.common.annotation.transform.TransformEnum;
import org.jjche.common.enums.FileType;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * <p>
 * 文件
 * </p>
 *
 * @author miaoyj
 * @since 2024-07-10
 */
@Data
public class FileVO implements Serializable {

    private Long id;

    @ApiModelProperty("文件访问地址")
    private String url;

    @ApiModelProperty(value = "文件大小，单位字节")
    private Long size;

    @ApiModelProperty("文件名称")
    private String filename;

    @ApiModelProperty("原始文件名")
    private String originalFilename;

    @ApiModelProperty("文件扩展名")
    private String ext;

    @ApiModelProperty("缩略图访问路径")
    private String thUrl;

    @ApiModelProperty("缩略图名称")
    private String thFilename;

    @ApiModelProperty("缩略图大小，单位字节")
    private Long thSize;

    @ApiModelProperty(value = "文件类型")
    @TransformEnum
    private FileType type;
    private String typeName;
    private Timestamp gmtCreate;
    private String createdBy;

    public String getSizeStr() {
        return DataSizeUtil.format(size);
    }
}
